import { css } from '@emotion/css';

export const mobileNavStyles = {
  mobileNav: css`
    .mobile-menu-button {
      display: none; // 默认隐藏
    }

    @media (max-width: 1024px) {
      .nav-content {
        justify-content: center;
        padding: 0 16px;
        position: relative;
      }

      .logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
      }

      .nav-links,
      .right-section {
        display: none;
      }

      .mobile-menu-button {
        display: flex;
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: #fff;
        padding: 8px;
        cursor: pointer;
        z-index: 1001;
        transition: all 0.3s ease;
        height: 40px;
        width: 40px;
        align-items: center;
        justify-content: center;

        &.open {
          position: fixed;
          right: 260px; // 侧边栏打开时移动到侧边栏左侧
          top: 20px;
          transform: none;
          font-size: 32px;
        }
      }
    }
  `,

  sidebar: css`
    .sidebar {
      position: fixed;
      top: 0;
      right: -300px;
      width: 300px;
      height: 100vh;
      background: #001529;
      z-index: 2000;
      transition: all 0.3s ease;
      box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
      display: flex;
      flex-direction: column;
      padding-right: 16px; // 添加右内边距，避免内容被滚动条遮挡
    }

    .sidebar.open {
      right: 0;
    }

    .sidebar-content {
      padding: 20px;
      height: 100%;
      overflow-y: auto;
      padding-top: 60px; // 为顶部按钮留出空间
    }

    .sidebar-menu {
      margin-top: 20px;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    .sidebar-menu a {
      color: #fff;
      text-decoration: none;
      padding: 12px 16px;
      border-radius: 4px;
      transition: background 0.3s ease;
      font-size: 16px;
    }

    .sidebar-menu a:hover {
      background: rgba(255, 255, 255, 0.1);
    }

    .sidebar-menu .dropdown-items {
      padding-left: 24px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .sidebar-menu .dropdown-items a {
      padding: 8px 16px;
      font-size: 14px;
    }

    // 侧边栏顶部搜索和登录区域
    .sidebar-top {
      padding: 20px 20px 20px 16px; // 调整左内边距
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);

      .search-box {
        margin-bottom: 16px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 20px;
        padding: 8px 16px;
        display: flex;
        align-items: center;

        input {
          background: none;
          border: none;
          color: #fff;
          width: 100%;
          padding: 4px;
          outline: none;

          &::placeholder {
            color: rgba(255, 255, 255, 0.5);
          }
        }

        .search-icon {
          color: rgba(255, 255, 255, 0.5);
        }
      }

      .login-button {
        display: flex;
        align-items: center;
        gap: 8px;
        background: rgba(255, 255, 255, 0.1);
        padding: 8px 16px;
        border-radius: 20px;
        color: #fff;
        text-decoration: none;
        transition: all 0.3s ease;
        width: 100%;
        justify-content: center;
        margin-right: 16px; // 增加右边距

        &:hover {
          background: rgba(255, 255, 255, 0.2);
        }
      }
    }
  `,

  overlay: css`
    .sidebar-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.5);
      z-index: 1999;
      opacity: 0;
      visibility: hidden;
      transition: all 0.3s ease;
    }

    .sidebar-overlay.visible {
      opacity: 1;
      visibility: visible;
    }
  `
}; 